package deliciouse.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import deliciouse.dao.FoodDao;
import deliciouse.dao.NewsDao;
import deliciouse.dao.impl.FoodDaoImpl;
import deliciouse.dao.impl.NewsDaoImpl;
import deliciouse.entity.Food;
import deliciouse.entity.News;

@WebServlet("/deliciousfoodindex")
public class DeliciousFoodIndexServlet extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		FoodDao f = new FoodDaoImpl();
		List<Food> list = f.getAll();
		NewsDao n = new NewsDaoImpl();
		List<News> news = n.getall();
		
		request.setAttribute("list", list);
		request.setAttribute("news", news);
		request.getRequestDispatcher("deliciousfoodindex.jsp").forward(request, response);
  }
}
